package com.quanyan.orderpay.request;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.quanyan.BaseRequest;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

/**
 * 申请退款可退整个订单.
 * 可以退该订单中部分商品.
 *
 * @author songzj
 * @date 16/6/8-14:01
 */
public class ReqOrderRefund extends BaseRequest {

    private String outTradeNo; //业务系统订单号
    @NotEmpty
    private String outTradeRefundNo; //业务系统退款单号
    @NotEmpty
    private String orderNo; //订单系统订单号
    @NotNull
    private Boolean needAudit; //是否需要审核.
    private String reason; //退款原因
    private String refundNotifyURL; //退款成功后回调
    @NotNull
    private Integer uid; //申请退款人ID
    private BigDecimal amount; //申请退款金额( 申请退款金额 <= 用户支付金额-累计退款金额)   已废弃
    @NotEmpty
    private List<ReqRefundProduct> refundProductList; //退款产品列表
    @NotEmpty
    @Valid
    private List<ReqRefundPayInfo> reqRefundPayInfos; //退款列表

    //鸟蛋使用 备注
    private String eggInfo;

    public String getEggInfo() {
        return eggInfo;
    }

    public void setEggInfo(String eggInfo) {
        this.eggInfo = eggInfo;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    @Deprecated
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Boolean getNeedAudit() {
        return needAudit;
    }

    public void setNeedAudit(Boolean needAudit) {
        this.needAudit = needAudit;
    }

    public String getOutTradeRefundNo() {
        return outTradeRefundNo;
    }

    public void setOutTradeRefundNo(String outTradeRefundNo) {
        this.outTradeRefundNo = outTradeRefundNo;
    }

    public List<ReqRefundProduct> getRefundProductList() {
        return refundProductList;
    }

    public void setRefundProductList(List<ReqRefundProduct> refundProductList) {
        this.refundProductList = refundProductList;
    }

    public List<ReqRefundPayInfo> getReqRefundPayInfos() {
        return reqRefundPayInfos;
    }

    public void setReqRefundPayInfos(List<ReqRefundPayInfo> reqRefundPayInfos) {
        this.reqRefundPayInfos = reqRefundPayInfos;
    }

    public String getRefundNotifyURL() {
        return refundNotifyURL;
    }

    public void setRefundNotifyURL(String refundNotifyURL) {
        this.refundNotifyURL = refundNotifyURL;
    }

    @Override
    public String toString() {
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        return gson.toJson(this);
    }
}
